package com.dayatang.hrm.compensation.infra.hibernate;

import java.util.List;

import org.apache.tapestry5.hibernate.HibernateSessionManager;

import com.dayatang.commons.repository.EntityRepositoryHibernateTapestry;
import com.dayatang.hrm.compensation.domain.FiscalYear;
import com.dayatang.hrm.compensation.domain.FiscalYearRepository;
import com.dayatang.hrm.organisation.domain.Organization;

@SuppressWarnings("unchecked")
public class FiscalYearRepositoryImpl extends
		EntityRepositoryHibernateTapestry<FiscalYear, Long> implements
		FiscalYearRepository {

	public FiscalYearRepositoryImpl(HibernateSessionManager sessionManager) {
		super(FiscalYear.class, sessionManager);
	}

	@Override
	public List<FiscalYear> findByOrganization(Organization org) {
		return getSessionManager().getSession().getNamedQuery(
				"FiscalYear.findByOrganization").setEntity("pOrg", org).list();
	}

}
